<?php	
	include('db_connection.php');

	class latest_news{
		function ltst_nws_add(){
			$insert = "INSERT INTO tbl_latest_news (latest_news) VALUES ('".$_POST['ltst_nws_txtarea']."')";
			$mysql_query = mysql_query($insert) or die(mysql_error());
			$msg = "Latest News has been added";
			return $msg;
		}
		

		function update_ltst_nws(){
			$select_news = "SELECT * FROM tbl_latest_news WHERE id='".$_POST['ltnws_id']."'";
			$query_news = mysql_query($select_news) or die(mysql_error());

			if(mysql_num_rows($query_news) > 0){
				$update_query = "UPDATE tbl_latest_news SET latest_news = '".$_POST['ltst_nws_txtarea']."', update_ts = now() WHERE id='".$_POST['ltnws_id']."'";
				$mysql_query = mysql_query($update_query) or die(mysql_error());
				$msg = "Latest News has been updated";
				return $msg;
			}
			
		}
	}
?>